#ifndef __CHATSERVER_H_
#define __CHATSERVER_H_

#include <muduo/net/TcpServer.h>
#include <muduo/net/EventLoop.h>
#include <muduo/net/InetAddress.h>

using namespace muduo;
using namespace muduo::net;

class ChatServer {
public:
    ChatServer(EventLoop *loop, const InetAddress &listenAddr, const string &nameArg);
    void start();
private:
    void onConnection(const TcpConnectionPtr &);
    void onMessage(const TcpConnectionPtr &, Buffer *, Timestamp);

    TcpServer m_server;  
    EventLoop* m_loop;   //指向事件循环的指针,在合适的时候可以调用quit方法退出循环
};

#endif // !__CHATSERVER_H_
